<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
        <title>今日订单 {{ day }}</title>
    </head>
    <body>        
        <h1>今日订餐记录 {{ day }}</h1>
        <a href="javascript:history.back()">返回</a>
        <ul id="order">
            {% if not object_list %}
            <h2>无</h2>
            {% endif %}
            
            <table id="order">
            {% for order in object_list %}
            <tr>
            <td>{{order.dt|date:"Y-m-d  H:i:s"}}</td>
            <td>{{ order.course.resta.name }}</td>
            <td><a href="{% url set_order order.course.id %}" title='点击订餐'>{{ order.course.name }}</a></td>
            <td>{{ order.course.price }}元</td>
            <td>{{ order.user.last_name }}</td>
            <td>
            {% if not user.is_superuser %}
                {% ifequal order.user user %}
                <a href="{% url del_order order.id %}">删除</a>
                {% endifequal %}
            {% else %}
                <a href="{% url del_order order.id %}">删除</a>
            {% endif %}
            </td>
            </tr>
            {% endfor %}
         </table>
        </ul>
        
        <table width="500px">
        {% for resta, course_cnt_map in resta_course_map.items %}        
            <tr>
                <td><b>{{ resta.name }}</b></td>
                <td>电话：{{ resta.phone }}</td>
            </tr>
            <tr>
                <td colspan="2"><hr /></td>
            </tr>
            {% for course, cnt in course_cnt_map.0.items %}
            <tr>
                <td>{{ course.name }}</td> <td>{{ cnt.0 }}份 × {{ course.price }}/份 = {{ cnt.1 }}元</td>
            </tr>
            {% endfor %}
            <tr>
                <td></td>
                <td><br /></td>
            </tr>
            <tr>
                <td></td>
                <td>合计 {{ course_cnt_map.1 }}元</td>
            </tr>
            <tr>
                <td><br /></td>
            </tr>
        {% endfor %}
        </table>
        
        {% include 'message.html' %}
    </body>
    
</html>